package com.smarthome.core.statisticsquery.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.springframework.stereotype.Service;

import com.smarthome.base.service.ShPropertyCompanyService;
import com.smarthome.base.service.ShResidenceService;
import com.smarthome.core.statisticsquery.VillageStatisticsService;
import com.smarthome.domain.bean.ShPropertyCompany;
import com.smarthome.domain.bean.ShResidence;
import com.smarthome.domain.vo.boss.Combobox;
import com.smarthome.domain.vo.boss.DataGrid;
import com.smarthome.domain.vo.boss.PageHelper;
@Service("villageStatisticsService")
public class VillageStatisticsServiceImpl implements VillageStatisticsService {

	
protected static Logger LOGGER;
	
	@Resource
    private ShResidenceService shResidenceService;
    
    @Resource
    private ShPropertyCompanyService shPropertyCompanyService;
    
    
	@Override
	public DataGrid dataGrid(ShResidence residence, PageHelper page) {
		return shResidenceService.queryDataGrid(residence, page);
	}

	@Override
	public List<Combobox> property(boolean flag) {
		List<Combobox> result = new ArrayList<>();
		if(flag) {
			result.add(new Combobox("","--请选择--",true));
		}
		List<ShPropertyCompany> shPropertyCompanys = shPropertyCompanyService.queryList(new ShPropertyCompany());
		for(ShPropertyCompany company:shPropertyCompanys) {
			result.add(new Combobox(String.valueOf(company.getId()),company.getName()));
		}
		return result;
	}

}
